package com.sunny.controller;

import java.util.Date;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 
 * @author Catkin_nice
 *
 */
@Controller
public class HomeController {
	
	@GetMapping({"/", "/home"})
	public String home(Map<String, Object> model) {
		model.put("time", new Date());
		return "home";
	}
	
	@GetMapping("/page/{pagename}")
	public String page(@PathVariable String pagename) {
		if ("adduser".equals(pagename)) {
			return "/user/add_user";		
		}
		return pagename;
	}
}
